package com.laiyw.monitor.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.laiyw.monitor.core.commons.OS;
import com.laiyw.monitor.core.ServerMonitorInfo;
import com.laiyw.monitor.core.annotation.Autowired;
import com.laiyw.monitor.core.annotation.Service;
import com.laiyw.monitor.service.MonitorService;

import java.util.List;

/**
 * @Description: Linux系统
 * @Auther: Laiyw
 * @Date: 2018/10/4 15:16
 */
@Service(OS.LINUX)
public class LinuxMonitorServiceImpl implements MonitorService {

    @Autowired
    private ServerMonitorInfo server;

    @Override
    public JSONObject getDashboard() {
        return null;
    }

    @Override
    public JSONObject getServerInfo() {
        return server.getServerInfo();
    }

    @Override
    public JSONObject getJvmInfo() {
        return server.getJvmInfo();
    }

    @Override
    public List<JSONObject> getServerCpuListInfo() {
        return server.getServerCpuListInfo();
    }

    @Override
    public JSONObject getMemory() {
        JSONObject json = new JSONObject();
        json.put("serverMemory", server.getServerMemory());
        json.put("jvmMemory", server.getJvmMemory());
        json.put("heapMemory", server.getHeapMemory());
        json.put("heapMemoryPool", server.getHeapMemoryPool());
        return json;
    }

    @Override
    public List<JSONObject> getServerDisk() {
        return server.getServerDisk();
    }
}
